package com.atguigu.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.sql.DataSource;

/**
 * @RestController 包含了@Controller和@ResponseBody，让所有方法直接响应数据
 *
 * @EnableConfigurationProperties(DataSourceProperties.class)
 * 表示当前类使用了配置类DataSourceProperties
 */
@RestController
public class HelloController {

    @Autowired
    private DataSource dataSource;

    @GetMapping("/hello")
    public String hello(){
        return "HelloWorld,SpringBoot~~你不太好啊~~";
    }

    @GetMapping("/hello2")
    public String hello2(){
        System.out.println(dataSource.getClass());
        return "HelloWorld,SpringBoot~~你好啊~~";
    }
}
